<?php
/**
 *CouponValidate
 * @author tan bing
 * @date 2021-09-15 17:22
 */


namespace Modules\Coupon\Validate\Admin;


use Modules\Coupon\Validate\BaseValidate;

class CouponValidate extends BaseValidate
{

    protected $rule = [
        'coupon_name'  => 'required',
        'coupon_type'  => 'required',
//        'reduce_price' => 'nullable|min:0|numeric',
//        'discount'     => 'nullable|min:1|max:9.9|numeric',
        'min_price'    => 'nullable|min:0',
        'total_num'    => 'required|nullable|min:0',
        'describe'     => 'required',
        'id'           => 'required',
    ];

    protected $message = [
        'coupon_name.required' => '优惠券名称不能为空',
        'coupon_type.required' => '优惠券类型不能为空',
//        'reduce_price.min'     => '减免金额不能小于0',
//        'discount.min'         => '折扣不能低于1折',
//        'discount.max'         => '折扣不能大于9.9折',
        'min_price.min'        => '最低消费金额不能小于0',
        'total_num.required'        => '发放数量不能小于0',
        'describe.required'    => '优惠券描述不能为空',
    ];

    protected $scene = [
        'add'    => [
            'coupon_name',
            'coupon_type',
            'reduce_price',
            'discount',
            'min_price',
            'total_num',
            'describe'
        ],
        'edit'   => [
            'id',
            'coupon_name',
            'coupon_type',
            'discount',
            'reduce_price',
            'min_price',
            'total_num',
            'describe'
        ],
        'status' => [],
    ];
}